<!DOCTYPE HTML>
<html lang="zh-tw" >
    <!-- Start book python基础语言 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>面向对象编程介绍 | python基础语言</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-emphasize/plugin.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../09day/section.2.html" />
    
    
    <link rel="prev" href="../09day/index.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="6.1"
        data-chapter-title="面向对象编程介绍"
        data-filepath="09day/section.1.md"
        data-basepath=".."
        data-revision="Thu Apr 06 2017 08:01:50 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Python基础
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="03day/index.html">
            
                
                    <a href="../03day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        认识python和基础知识
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="03day/section.1.html">
            
                
                    <a href="../03day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        认识python(了解)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="03day/section.2.html">
            
                
                    <a href="../03day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        第一个python程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="03day/section.3.html">
            
                
                    <a href="../03day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        注释
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="03day/section.4.html">
            
                
                    <a href="../03day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        变量以及类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="03day/section.5.html">
            
                
                    <a href="../03day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        标示符和关键字
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="03day/section.6.html">
            
                
                    <a href="../03day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        输出
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="03day/section.4.1.html">
            
                
                    <a href="../03day/section.4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        输入
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="03day/section.7.html">
            
                
                    <a href="../03day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="03day/section.10.html">
            
                
                    <a href="../03day/section.10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.9.</b>
                        
                        数据类型转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="04day/section.1.html">
            
                
                    <a href="../04day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.10.</b>
                        
                        判断语句介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="04day/section.2.html">
            
                
                    <a href="../04day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.11.</b>
                        
                        if语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="04day/section.3.html">
            
                
                    <a href="../04day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.12.</b>
                        
                        比较、关系运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="03day/section.99.html">
            
                
                    <a href="../03day/section.99.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.13.</b>
                        
                        作业
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="03day/section.8.html">
            
                
                    <a href="../03day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.14.</b>
                        
                        附录-推荐的python电子书
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="04day/index.html">
            
                
                    <a href="../04day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        判断语句和循环语句
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="04day/section.4.html">
            
                
                    <a href="../04day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        if-else
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="04day/section.4.1.html">
            
                
                    <a href="../04day/section.4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        elif
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="04day/section.5.html">
            
                
                    <a href="../04day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        if嵌套
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="04day/section.6.html">
            
                
                    <a href="../04day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        if应用:猜拳游戏
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="04day/section.7.html">
            
                
                    <a href="../04day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        循环语句介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="04day/section.8.html">
            
                
                    <a href="../04day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        while循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="04day/section.8.1.html">
            
                
                    <a href="../04day/section.8.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        while循环应用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="04day/section.9.html">
            
                
                    <a href="../04day/section.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        while循环的嵌套以及应用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="04day/section.11.html">
            
                
                    <a href="../04day/section.11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="04day/section.10.html">
            
                
                    <a href="../04day/section.10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        break和continue
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="04day/section.12.html">
            
                
                    <a href="../04day/section.12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        总结
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="04day/section.99.html">
            
                
                    <a href="../04day/section.99.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        作业
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="05day/index.html">
            
                
                    <a href="../05day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        字符串、列表、元组、字典
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="05day/section.1.html">
            
                
                    <a href="../05day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        字符串介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="05day/section.2.html">
            
                
                    <a href="../05day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        字符串输出
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="05day/section.3.html">
            
                
                    <a href="../05day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        字符串输入
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="05day/section.4.html">
            
                
                    <a href="../05day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        下标和切片
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="05day/section.4.2.html">
            
                
                    <a href="../05day/section.4.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        字符串常见操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="05day/section.5.html">
            
                
                    <a href="../05day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        列表介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="05day/section.6.html">
            
                
                    <a href="../05day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        列表的循环遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="05day/section.7.html">
            
                
                    <a href="../05day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        列表的常见操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="05day/section.8.html">
            
                
                    <a href="../05day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        列表的嵌套
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="06day/section.3.html">
            
                
                    <a href="../06day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        元组
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="06day/section.1.html">
            
                
                    <a href="../06day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        字典介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="06day/section.2.html">
            
                
                    <a href="../06day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        字典的常见操作1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="06day/section.2.1.html">
            
                
                    <a href="../06day/section.2.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        字典的常见操作2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="06day/section.2.2.html">
            
                
                    <a href="../06day/section.2.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        字典的遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="06day/section.2.3.html">
            
                
                    <a href="../06day/section.2.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.15.</b>
                        
                        公共方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="05day/section.99.html">
            
                
                    <a href="../05day/section.99.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.16.</b>
                        
                        作业
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="06day/index.html">
            
                
                    <a href="../06day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        函数
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="07day/section.1.html">
            
                
                    <a href="../07day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        函数介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="07day/section.2.html">
            
                
                    <a href="../07day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        函数定义、调用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="07day/section.2.1.html">
            
                
                    <a href="../07day/section.2.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        函数的文档说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="07day/section.3.html">
            
                
                    <a href="../07day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        函数参数(一)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="07day/section.4.html">
            
                
                    <a href="../07day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        函数返回值(一)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="07day/section.5.html">
            
                
                    <a href="../07day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        4种函数的类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="07day/section.6.html">
            
                
                    <a href="../07day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        函数的嵌套调用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="07day/section.6.1.html">
            
                
                    <a href="../07day/section.6.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        函数应用：打印图形和数学计算
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="07day/section.7.0.html">
            
                
                    <a href="../07day/section.7.0.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        局部变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="07day/section.8.html">
            
                
                    <a href="../07day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.10.</b>
                        
                        全局变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="07day/section.8.1.html">
            
                
                    <a href="../07day/section.8.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.11.</b>
                        
                        函数应用：学生管理系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="06day/section.4.1.html">
            
                
                    <a href="../06day/section.4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.12.</b>
                        
                        函数返回值(二)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="06day/section.3.1.html">
            
                
                    <a href="../06day/section.3.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.13.</b>
                        
                        函数参数(二)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="06day/section.2.4.html">
            
                
                    <a href="../06day/section.2.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.14.</b>
                        
                        引用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.15" data-path="07day/section.9.html">
            
                
                    <a href="../07day/section.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.15.</b>
                        
                        递归函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.16" data-path="07day/section.9.1.html">
            
                
                    <a href="../07day/section.9.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.16.</b>
                        
                        匿名函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.17" data-path="07day/section.7.html">
            
                
                    <a href="../07day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.17.</b>
                        
                        函数使用注意事项
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.18" data-path="07day/section.99.html">
            
                
                    <a href="../07day/section.99.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.18.</b>
                        
                        作业
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="08day/index.html">
            
                
                    <a href="../08day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        文件操作、综合应用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="08day/section.1.html">
            
                
                    <a href="../08day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        文件操作介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="08day/section.2.html">
            
                
                    <a href="../08day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        文件的打开与关闭
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="08day/section.3.html">
            
                
                    <a href="../08day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        文件的读写
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="08day/section.3.1.html">
            
                
                    <a href="../08day/section.3.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        应用1:制作文件的备份
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="08day/section.4.html">
            
                
                    <a href="../08day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        文件的定位读写
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="08day/section.5.html">
            
                
                    <a href="../08day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        文件的重命名、删除
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="08day/section.6.html">
            
                
                    <a href="../08day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        文件夹的相关操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="08day/section.9.html">
            
                
                    <a href="../08day/section.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.8.</b>
                        
                        应用2:批量修改文件名
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.9" data-path="08day/section.10.html">
            
                
                    <a href="../08day/section.10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.9.</b>
                        
                        综合应用:学生管理系统(文件版)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.10" data-path="08day/section.99.html">
            
                
                    <a href="../08day/section.99.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.10.</b>
                        
                        作业
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="09day/index.html">
            
                
                    <a href="../09day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        面向对象1
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="6.1" data-path="09day/section.1.html">
            
                
                    <a href="../09day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        面向对象编程介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="09day/section.2.html">
            
                
                    <a href="../09day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        类和对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="09day/section.3.html">
            
                
                    <a href="../09day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        定义类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="09day/section.4.html">
            
                
                    <a href="../09day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        创建对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="09day/section.5.html">
            
                
                    <a href="../09day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        __init__方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="09day/section.5.1.html">
            
                
                    <a href="../09day/section.5.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        应用:创建多个对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="09day/section.4.4.html">
            
                
                    <a href="../09day/section.4.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        &quot;魔法&quot;方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="09day/section.4.1.html">
            
                
                    <a href="../09day/section.4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.8.</b>
                        
                        self
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.9" data-path="09day/section.5.2.html">
            
                
                    <a href="../09day/section.5.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.9.</b>
                        
                        应用:烤地瓜
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.10" data-path="09day/section.5.4.html">
            
                
                    <a href="../09day/section.5.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.10.</b>
                        
                        隐藏数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.11" data-path="09day/section.5.3.html">
            
                
                    <a href="../09day/section.5.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.11.</b>
                        
                        应用:存放家具
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="10day/index.html">
            
                
                    <a href="../10day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        面向对象2
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="09day/section.12.html">
            
                
                    <a href="../09day/section.12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        应用:老王开枪
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="09day/section.4.3.html">
            
                
                    <a href="../09day/section.4.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        保护对象的属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="09day/section.6.html">
            
                
                    <a href="../09day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        __del__方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="09day/section.7.html">
            
                
                    <a href="../09day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        单继承
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="09day/section.8.html">
            
                
                    <a href="../09day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        多继承
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="09day/section.8.1.html">
            
                
                    <a href="../09day/section.8.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        重写父类方法与调用父类方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="09day/section.9.html">
            
                
                    <a href="../09day/section.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.7.</b>
                        
                        多态
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.8" data-path="09day/section.9.1.html">
            
                
                    <a href="../09day/section.9.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.8.</b>
                        
                        类属性、实例属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.9" data-path="09day/section.10.html">
            
                
                    <a href="../09day/section.10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.9.</b>
                        
                        静态方法和类方法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="11day/index.html">
            
                
                    <a href="../11day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        面向对象3、异常、模块
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="09day/section.15.html">
            
                
                    <a href="../09day/section.15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        练习：设计类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="09day/section.14.html">
            
                
                    <a href="../09day/section.14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.</b>
                        
                        工厂模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="11day/section.4.html">
            
                
                    <a href="../11day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.3.</b>
                        
                        __new__方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="09day/section.13.html">
            
                
                    <a href="../09day/section.13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.4.</b>
                        
                        单例模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.5" data-path="10day/section.1.html">
            
                
                    <a href="../10day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.5.</b>
                        
                        异常介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.6" data-path="10day/section.2.html">
            
                
                    <a href="../10day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.6.</b>
                        
                        捕获异常
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.7" data-path="10day/section.2.2.html">
            
                
                    <a href="../10day/section.2.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.7.</b>
                        
                        异常的传递
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.8" data-path="10day/section.3.html">
            
                
                    <a href="../10day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.8.</b>
                        
                        抛出自定义的异常
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.9" data-path="10day/section.3.2.html">
            
                
                    <a href="../10day/section.3.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.9.</b>
                        
                        异常处理中抛出异常
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.10" data-path="08day/section.7.html">
            
                
                    <a href="../08day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.10.</b>
                        
                        模块介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.11" data-path="08day/section.8.html">
            
                
                    <a href="../08day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.11.</b>
                        
                        模块制作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.12" data-path="08day/section.8.3.html">
            
                
                    <a href="../08day/section.8.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.12.</b>
                        
                        模块中的__all__
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.13" data-path="08day/section.7.1.html">
            
                
                    <a href="../08day/section.7.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.13.</b>
                        
                        python中的包
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.14" data-path="08day/section.8.1.html">
            
                
                    <a href="../08day/section.8.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.14.</b>
                        
                        模块发布
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.15" data-path="08day/section.8.2.html">
            
                
                    <a href="../08day/section.8.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.15.</b>
                        
                        模块安装、使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9" data-path="12day/index.html">
            
                
                    <a href="../12day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        强化练习
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="12day/section.3.html">
            
                
                    <a href="../12day/section.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        给程序传参数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="12day/section.4.html">
            
                
                    <a href="../12day/section.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.</b>
                        
                        列表推导式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.3" data-path="12day/section.5.html">
            
                
                    <a href="../12day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.3.</b>
                        
                        set、list、tuple
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.4" data-path="12day/section.2.html">
            
                
                    <a href="../12day/section.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.4.</b>
                        
                        面试题1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.5" data-path="12day/section.1.html">
            
                
                    <a href="../12day/section.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.5.</b>
                        
                        面试题2
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" data-path="07day/index.html">
            
                
                    <a href="../07day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        应用:打飞机
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1" data-path="10day/section.5.html">
            
                
                    <a href="../10day/section.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.</b>
                        
                        打飞机代码：搭建界面
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="10day/section.6.html">
            
                
                    <a href="../10day/section.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.</b>
                        
                        打飞机代码：检测键盘
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.3" data-path="10day/section.7.html">
            
                
                    <a href="../10day/section.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.3.</b>
                        
                        打飞机代码：显示、控制玩具飞机-面向过程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.4" data-path="10day/section.8.html">
            
                
                    <a href="../10day/section.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.4.</b>
                        
                        打飞机代码：显示、控制玩具飞机-面向对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.5" data-path="10day/section.9.html">
            
                
                    <a href="../10day/section.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.5.</b>
                        
                        打飞机代码：玩家飞机发射子弹
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.6" data-path="10day/section.12.html">
            
                
                    <a href="../10day/section.12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.6.</b>
                        
                        打飞机代码：显示敌机
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.7" data-path="10day/section.11.html">
            
                
                    <a href="../10day/section.11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.7.</b>
                        
                        打飞机代码：优化代码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.8" data-path="10day/section.13.html">
            
                
                    <a href="../10day/section.13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.8.</b>
                        
                        打飞机代码：让敌机移动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.9" data-path="10day/section.14.html">
            
                
                    <a href="../10day/section.14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.9.</b>
                        
                        打飞机代码：敌机发射子弹
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.10" data-path="10day/section.16.html">
            
                
                    <a href="../10day/section.16.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.10.</b>
                        
                        打飞机代码：代码优化-抽象出基类
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本書使用 GitBook 釋出
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >python基础语言</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#x4ECB;&#x7ECD;">&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#x4ECB;&#x7ECD;</h1>
<h2 id="&#x60F3;&#x4E00;&#x60F3;">&#x60F3;&#x4E00;&#x60F3;</h2>
<p><strong>&#x8BF7;&#x7528;&#x7A0B;&#x5E8F;&#x63CF;&#x8FF0;&#x5982;&#x4E0B;&#x4E8B;&#x60C5;&#xFF1A;</strong></p>
<ul>
<li>A&#x540C;&#x5B66;&#x62A5;&#x9053;&#x767B;&#x8BB0;&#x4FE1;&#x606F;</li>
<li>B&#x540C;&#x5B66;&#x62A5;&#x9053;&#x767B;&#x8BB0;&#x4FE1;&#x606F;</li>
<li>C&#x540C;&#x5B66;&#x62A5;&#x9053;&#x767B;&#x8BB0;&#x4FE1;&#x606F;</li>
<li>A&#x540C;&#x5B66;&#x505A;&#x81EA;&#x6211;&#x4ECB;&#x7ECD;</li>
<li>B&#x540C;&#x5B66;&#x505A;&#x81EA;&#x6211;&#x4ECB;&#x7ECD;</li>
<li>C&#x540C;&#x5B66;&#x505A;&#x81EA;&#x6211;&#x4ECB;&#x7ECD;</li>
</ul>
<pre><code class="lang-python">stu_a = {
        <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;A&quot;</span>,
        <span class="hljs-string">&quot;age&quot;</span>:<span class="hljs-number">21</span>,
        <span class="hljs-string">&quot;gender&quot;</span>:<span class="hljs-number">1</span>,
        <span class="hljs-string">&quot;hometown&quot;</span>:<span class="hljs-string">&quot;&#x6CB3;&#x5317;&quot;</span>
}
stu_b = {
        <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;B&quot;</span>,
        <span class="hljs-string">&quot;age&quot;</span>:<span class="hljs-number">22</span>,
        <span class="hljs-string">&quot;gender&quot;</span>:<span class="hljs-number">0</span>,
        <span class="hljs-string">&quot;hometown&quot;</span>:<span class="hljs-string">&quot;&#x5C71;&#x4E1C;&quot;</span>
}
stu_c = {
        <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;C&quot;</span>,
        <span class="hljs-string">&quot;age&quot;</span>:<span class="hljs-number">20</span>,
        <span class="hljs-string">&quot;gender&quot;</span>:<span class="hljs-number">1</span>,
        <span class="hljs-string">&quot;hometown&quot;</span>:<span class="hljs-string">&quot;&#x5B89;&#x5FBD;&quot;</span>
}
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">stu_intro</span><span class="hljs-params">(stu)</span>:</span>
        <span class="hljs-string">&quot;&quot;&quot;&#x81EA;&#x6211;&#x4ECB;&#x7ECD;&quot;&quot;&quot;</span>
        <span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">in</span> stu.items():
                print(<span class="hljs-string">&quot;key=%s, value=%d&quot;</span>%(key,value))

stu_intro(stu_a)
stu_intro(stu_b)
stu_intro(stu_c)
</code></pre>
<h4 id="&#x8003;&#x8651;&#x73B0;&#x5B9E;&#x751F;&#x6D3B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x7684;&#x601D;&#x7EF4;&#x65B9;&#x5F0F;&#x662F;&#x653E;&#x5728;&#x5B66;&#x751F;&#x8FD9;&#x4E2A;&#x4E2A;&#x4EBA;&#x4E0A;&#xFF0C;&#x662F;&#x5B66;&#x751F;&#x505A;&#x4E86;&#x81EA;&#x6211;&#x4ECB;&#x7ECD;&#x3002;&#x800C;&#x4E0D;&#x662F;&#x50CF;&#x6211;&#x4EEC;&#x521A;&#x521A;&#x5199;&#x51FA;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x5148;&#x6709;&#x4E86;&#x4ECB;&#x7ECD;&#x7684;&#x884C;&#x4E3A;&#xFF0C;&#x518D;&#x53BB;&#x770B;&#x4ECB;&#x7ECD;&#x4E86;&#x8C01;&#x3002;">&#x8003;&#x8651;&#x73B0;&#x5B9E;&#x751F;&#x6D3B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x7684;&#x601D;&#x7EF4;&#x65B9;&#x5F0F;&#x662F;&#x653E;&#x5728;&#x5B66;&#x751F;&#x8FD9;&#x4E2A;&#x4E2A;&#x4EBA;&#x4E0A;&#xFF0C;&#x662F;&#x5B66;&#x751F;&#x505A;&#x4E86;&#x81EA;&#x6211;&#x4ECB;&#x7ECD;&#x3002;&#x800C;&#x4E0D;&#x662F;&#x50CF;&#x6211;&#x4EEC;&#x521A;&#x521A;&#x5199;&#x51FA;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x5148;&#x6709;&#x4E86;&#x4ECB;&#x7ECD;&#x7684;&#x884C;&#x4E3A;&#xFF0C;&#x518D;&#x53BB;&#x770B;&#x4ECB;&#x7ECD;&#x4E86;&#x8C01;&#x3002;</h4>
<h4 id="&#x7528;&#x6211;&#x4EEC;&#x7684;&#x73B0;&#x5B9E;&#x601D;&#x7EF4;&#x65B9;&#x5F0F;&#x8BE5;&#x600E;&#x4E48;&#x7528;&#x7A0B;&#x5E8F;&#x8868;&#x8FBE;&#x5462;&#xFF1F;">&#x7528;&#x6211;&#x4EEC;&#x7684;&#x73B0;&#x5B9E;&#x601D;&#x7EF4;&#x65B9;&#x5F0F;&#x8BE5;&#x600E;&#x4E48;&#x7528;&#x7A0B;&#x5E8F;&#x8868;&#x8FBE;&#x5462;&#xFF1F;</h4>
<pre><code class="lang-python">stu_a = Student(&#x4E2A;&#x4EBA;&#x4FE1;&#x606F;)
stu_b = Student(&#x4E2A;&#x4EBA;&#x4FE1;&#x606F;)
stu_c = Student(&#x4E2A;&#x4EBA;&#x4FE1;&#x606F;)
stu_a.intro()
stu_a.intro()
stu_a.intro()
</code></pre>
<ul>
<li>&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#xFF1A;&#x6839;&#x636E;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x4ECE;&#x4E0A;&#x5230;&#x4E0B;&#x5199;&#x4EE3;&#x7801;</li>
<li>&#x9762;&#x5411;&#x5BF9;&#x8C61;&#xFF1A;&#x5C06;&#x6570;&#x636E;&#x4E0E;&#x51FD;&#x6570;&#x7ED1;&#x5B9A;&#x5230;&#x4E00;&#x8D77;&#xFF0C;&#x8FDB;&#x884C;&#x5C01;&#x88C5;&#xFF0C;&#x8FD9;&#x6837;&#x80FD;&#x591F;&#x66F4;&#x5FEB;&#x901F;&#x7684;&#x5F00;&#x53D1;&#x7A0B;&#x5E8F;&#xFF0C;&#x51CF;&#x5C11;&#x4E86;&#x91CD;&#x590D;&#x4EE3;&#x7801;&#x7684;&#x91CD;&#x5199;&#x8FC7;&#x7A0B;</li>
</ul>
<p>&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7F16;&#x7A0B;&#x6700;&#x6613;&#x88AB;&#x521D;&#x5B66;&#x8005;&#x63A5;&#x53D7;&#xFF0C;&#x5176;&#x5F80;&#x5F80;&#x7528;&#x4E00;&#x957F;&#x6BB5;&#x4EE3;&#x7801;&#x6765;&#x5B9E;&#x73B0;&#x6307;&#x5B9A;&#x529F;&#x80FD;&#xFF0C;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;&#x7684;&#x601D;&#x8DEF;&#x662F;&#x5C06;&#x6570;&#x636E;&#x4E0E;&#x51FD;&#x6570;&#x6309;&#x7167;&#x6267;&#x884C;&#x7684;&#x903B;&#x8F91;&#x987A;&#x5E8F;&#x7EC4;&#x7EC7;&#x5728;&#x4E00;&#x8D77;&#xFF0C;&#x6570;&#x636E;&#x4E0E;&#x51FD;&#x6570;&#x5206;&#x5F00;&#x8003;&#x8651;&#x3002;</p>
<pre><code class="lang-python">
def &#x53D1;&#x9001;&#x90AE;&#x4EF6;(&#x5185;&#x5BB9;)
        #&#x53D1;&#x9001;&#x90AE;&#x4EF6;&#x63D0;&#x9192;
        &#x8FDE;&#x63A5;&#x90AE;&#x7BB1;&#x670D;&#x52A1;&#x5668;
        &#x53D1;&#x9001;&#x90AE;&#x4EF6;
        &#x5173;&#x95ED;&#x8FDE;&#x63A5;

while True&#xFF1A;

        if cpu&#x5229;&#x7528;&#x7387; &gt; 90%:
                &#x53D1;&#x9001;&#x90AE;&#x4EF6;(&apos;CPU&#x62A5;&#x8B66;&apos;)

        if &#x786C;&#x76D8;&#x4F7F;&#x7528;&#x7A7A;&#x95F4; &gt; 90%:
                &#x53D1;&#x9001;&#x90AE;&#x4EF6;(&apos;&#x786C;&#x76D8;&#x62A5;&#x8B66;&apos;)

        if &#x5185;&#x5B58;&#x5360;&#x7528; &gt; 80%:
                &#x53D1;&#x9001;&#x90AE;&#x4EF6;(&apos;&#x5185;&#x5B58;&#x62A5;&#x8B66;&apos;)
</code></pre>
<p>&#x4ECA;&#x5929;&#x6211;&#x4EEC;&#x6765;&#x5B66;&#x4E60;&#x4E00;&#x79CD;&#x65B0;&#x7684;&#x7F16;&#x7A0B;&#x65B9;&#x5F0F;&#xFF1A;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#xFF08;Object Oriented Programming&#xFF0C;OOP&#xFF0C;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#xFF09;</p>
<ul>
<li><p>1&#xFF09;&#x89E3;&#x51B3;&#x83DC;&#x9E1F;&#x4E70;&#x7535;&#x8111;&#x7684;&#x6545;&#x4E8B;</p>
<p>&#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x5F0F;:</p>
<blockquote>
<p>   1)&#x5728;&#x7F51;&#x4E0A;&#x67E5;&#x627E;&#x8D44;&#x6599;</p>
<p>   2)&#x6839;&#x636E;&#x81EA;&#x5DF1;&#x9884;&#x7B97;&#x548C;&#x9700;&#x6C42;&#x5B9A;&#x7535;&#x8111;&#x7684;&#x578B;&#x53F7; MacBook 15 &#x9876;&#x914D; 1W8</p>
<p>   3)&#x53BB;&#x5E02;&#x573A;&#x627E;&#x5230;&#x82F9;&#x679C;&#x5E97;&#x5404;&#x79CD;&#x5E97;&#x65E0;&#x6CD5;&#x7504;&#x522B;&#x771F;&#x5047; &#x968F;&#x4FBF;&#x627E;&#x4E86;&#x4E00;&#x5BB6;</p>
<p>   4)&#x627E;&#x5230;&#x4E1A;&#x52A1;&#x5458;,&#x4E1A;&#x52A1;&#x5458;&#x63A8;&#x8350;&#x4E86;&#x53E6;&#x5916;&#x4E00;&#x6B3E; &#x914D;&#x7F6E;&#x66F4;&#x9AD8;&#x4EF7;&#x683C;&#x4FBF;&#x5B9C;,&#x4E5F;&#x662F;&#x82F9;&#x679C;&#x7CFB;&#x7EDF;&#x7684; 1W</p>
<p>   5)&#x780D;&#x4EF7;30&#x5206;&#x949F; &#x4ED8;&#x6B3E;9999</p>
<p>   6)&#x6210;&#x4EA4;</p>
<p>   &#x56DE;&#x53BB;&#x4E4B;&#x540E;&#x53D1;&#x73B0;&#x5404;&#x79CD;&#x95EE;&#x9898; </p>
</blockquote>
<p>&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F; : </p>
<blockquote>
<p>1)&#x627E;&#x4E00;&#x4E2A;&#x9760;&#x8C31;&#x7684;&#x7535;&#x8111;&#x9AD8;&#x624B;</p>
<p>2)&#x7ED9;&#x94B1;&#x4EA4;&#x6613;</p>
</blockquote>
</li>
<li><p>&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x548C;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x90FD;&#x662F;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x7684;&#x4E00;&#x79CD;&#x601D;&#x8DEF;&#x800C;&#x5DF2;</p>
<ul>
<li><p>&#x4E70;&#x7535;&#x8111;&#x7684;&#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x5F0F;:</p>
<ul>
<li>&#x5F3A;&#x8C03;&#x7684;&#x662F;&#x6B65;&#x9AA4;&#x3001;&#x8FC7;&#x7A0B;&#x3001;&#x6BCF;&#x4E00;&#x6B65;&#x90FD;&#x662F;&#x81EA;&#x5DF1;&#x4EB2;&#x81EA;&#x53BB;&#x5B9E;&#x73B0;&#x7684;</li>
<li>&#x8FD9;&#x79CD;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x7684;&#x601D;&#x8DEF;&#x6211;&#x4EEC;&#x5C31;&#x53EB;&#x505A;&#x9762;&#x5411;&#x8FC7;&#x7A0B;</li>
</ul>
</li>
<li><p>&#x4E70;&#x7535;&#x8111;&#x7684;&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F;:</p>
<ul>
<li>&#x5F3A;&#x8C03;&#x7684;&#x662F;&#x7535;&#x8111;&#x9AD8;&#x624B;,  &#x7535;&#x8111;&#x9AD8;&#x624B;&#x662F;&#x5904;&#x7406;&#x8FD9;&#x4EF6;&#x4E8B;&#x7684;&#x4E3B;&#x89D2;,&#x5BF9;&#x6211;&#x4EEC;&#x800C;&#x8A00;,&#x6211;&#x4EEC;&#x5E76;&#x4E0D;&#x5FC5;&#x4EB2;&#x81EA;&#x5B9E;&#x73B0;&#x6574;&#x4E2A;&#x6B65;&#x9AA4;&#x53EA;&#x9700;&#x8981;&#x8C03;&#x7528;&#x7535;&#x8111;&#x9AD8;&#x624B;&#x5C31;&#x53EF;&#x4EE5;&#x89E3;&#x51B3;&#x95EE;&#x9898;</li>
<li>&#x8FD9;&#x79CD;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x7684;&#x601D;&#x8DEF;&#x5C31; &#x662F;&#x9762;&#x5411;&#x5BF9;&#x8C61;</li>
</ul>
</li>
<li><p>&#x7528;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x601D;&#x7EF4;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x7684;&#x91CD;&#x70B9;</p>
<ul>
<li>&#x5F53;&#x9047;&#x5230;&#x4E00;&#x4E2A;&#x9700;&#x6C42;&#x7684;&#x65F6;&#x5019;&#x4E0D;&#x7528;&#x81EA;&#x5DF1;&#x53BB;&#x5B9E;&#x73B0;&#xFF0C;&#x5982;&#x679C;&#x81EA;&#x5DF1;&#x4E00;&#x6B65;&#x6B65;&#x5B9E;&#x73B0;&#x90A3;&#x5C31;&#x662F;&#x9762;&#x5411;&#x8FC7;&#x7A0B;</li>
<li>&#x5E94;&#x8BE5;&#x627E;&#x4E00;&#x4E2A;&#x4E13;&#x95E8;&#x505A;&#x8FD9;&#x4E2A;&#x4E8B;&#x7684;&#x4EBA;&#x6765;&#x505A;</li>
<li>&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x662F;&#x57FA;&#x4E8E;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7684;</li>
</ul>
</li>
</ul>
</li>
<li><p>2&#xFF09;&#x89E3;&#x51B3;&#x5403;&#x5564;&#x9152;&#x9E2D;&#x7684;&#x95EE;&#x9898;</p>
<p>&#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x5F0F;&#xFF08;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#xFF09;:</p>
<blockquote>
<p>1)&#x517B;&#x9E2D;&#x5B50;</p>
<p>2)&#x9E2D;&#x5B50;&#x957F;&#x6210;</p>
<p>3)&#x6740;</p>
<p>4)&#x4F5C;&#x6599;</p>
<p>5)&#x70F9;&#x996A;</p>
<p>6)&#x5403; </p>
<p>7)&#x5352; </p>
</blockquote>
<p>&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F;&#xFF08;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#xFF09;: </p>
<blockquote>
<p>1)&#x627E;&#x4E2A;&#x5356;&#x5564;&#x9152;&#x9E2D;&#x7684;&#x4EBA; </p>
<p>2)&#x7ED9;&#x94B1; &#x4EA4;&#x6613;</p>
<p>3)&#x5403;</p>
<p>4)&#x80D6;6&#x65A4; </p>
</blockquote>
<p>&#x9700;&#x8981;&#x4E86;&#x89E3;&#x7684;&#x5B9A;&#x4E49;&#x6027;&#x6587;&#x5B57;: </p>
<p>&#x9762;&#x5411;&#x5BF9;&#x8C61;(object-oriented ;&#x7B80;&#x79F0;: OO) &#x81F3;&#x4ECA;&#x8FD8;&#x6CA1;&#x6709;&#x7EDF;&#x4E00;&#x7684;&#x6982;&#x5FF5;
&#x6211;&#x8FD9;&#x91CC;&#x628A;&#x5B83;&#x5B9A;&#x4E49;&#x4E3A;: &#x6309;&#x4EBA;&#x4EEC; &#x8BA4;&#x8BC6;&#x5BA2;&#x89C2;&#x4E16;&#x754C;&#x7684;&#x7CFB;&#x7EDF;&#x601D;&#x7EF4;&#x65B9;&#x5F0F;,&#x91C7;&#x7528;&#x57FA;&#x4E8E;&#x5BF9;&#x8C61;(&#x5B9E;&#x4F53;) &#x7684;&#x6982;&#x5FF5;&#x5EFA;&#x7ACB;&#x6A21;&#x578B;,&#x6A21;&#x62DF;&#x5BA2;&#x89C2;&#x4E16;&#x754C;&#x5206;&#x6790;&#x3001;&#x8BBE; &#x8BA1;&#x3001;&#x5B9E;&#x73B0;&#x8F6F;&#x4EF6;&#x7684;&#x529E;&#x6CD5;&#x3002;</p>
<p>&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;(Object Oriented Programming-OOP) &#x662F;&#x4E00;&#x79CD;&#x89E3;&#x51B3;&#x8F6F;&#x4EF6;&#x590D;&#x7528;&#x7684;&#x8BBE;&#x8BA1;&#x548C;&#x7F16;&#x7A0B;&#x65B9;&#x6CD5;&#x3002;  &#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x628A;&#x8F6F;&#x4EF6;&#x7CFB;&#x7EDF;&#x4E2D;&#x76F8;&#x8FD1;&#x76F8;&#x4F3C;&#x7684;&#x64CD;&#x4F5C;&#x903B;&#x8F91;&#x548C;&#x64CD;&#x4F5C;  &#x5E94;&#x7528;&#x6570;&#x636E;&#x3001;&#x72B6;&#x6001;,&#x4EE5;&#x7C7B;&#x7684;&#x578B;&#x5F0F;&#x63CF;&#x8FF0;&#x51FA;&#x6765;,&#x4EE5;&#x5BF9;&#x8C61;&#x5B9E;&#x4F8B;&#x7684;&#x5F62;&#x5F0F;&#x5728;&#x8F6F;&#x4EF6;&#x7CFB;&#x7EDF;&#x4E2D;&#x590D;&#x7528;,&#x4EE5;&#x8FBE;&#x5230;&#x63D0;&#x9AD8;&#x8F6F;&#x4EF6;&#x5F00;&#x53D1;&#x6548;&#x7387;&#x7684;&#x4F5C;&#x7528;&#x3002;</p>
</li>
</ul>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../09day/index.html" class="navigation navigation-prev " aria-label="Previous page: 面向对象1"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../09day/section.2.html" class="navigation navigation-next " aria-label="Next page: 类和对象"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"toggle-chapters":{},"splitter":{},"emphasize":{},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book python基础语言 -->
</html>
